import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;


public class HdfsDemo {
	public static void main(String[] args) throws IOException {
		FileSystem fs = FileSystem.get(new Configuration());
		FSDataInputStream in = fs.open(new Path(args[0]), 16);
		try {
			IOUtils.copyBytes(in, System.out, 4096	, false);
		} catch (Exception e) {
			// TODO: handle exception
		}finally{
			IOUtils.closeStream(in);
		}
		
	}
}
